#include <iostream>

using namespace std;

class Build_1 {
protected:
	int posi_x;
	int posi_y;
	int area;

public:
	Build_1(int x=0, int y=0, int area=0);
	~Build_1();
	void set1(int x, int y, int a);
};

Build_1::Build_1(int x, int y, int area) {
	this->posi_x = x;
	this->posi_y = y;
	this->area = area;
}

Build_1::~Build_1() {
	cout << "Destructing..." << endl;
}

void Build_1::set1(int x, int y, int a) {
	this->posi_x = x;
	this->posi_y = y;
	this->area = a;
}

class Build_2 : public Build_1 {
	protected:
		int height;

	public:
		void set2(int h);
		friend ostream & operator << (ostream & os, const Build_2 &);
};

void Build_2::set2(int h) {
	this->height = h;
}

ostream & operator << (ostream & os, const Build_2 & obj) {
	os << "x:" << obj.posi_x << "  y:"<< obj.posi_y << "\narea:" << obj.area << "\nheight:" << obj.height;
	return os;
}

int main(int argc, char * argv[]) {
	Build_2 obj;
	obj.set1(100, 200, 300);
	obj.set2(400);
	cout << obj << endl;

	return 0;
}
